﻿using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Drawing;
using System.Linq;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;

using System.Collections.Generic;
using BPM.Foundation.WFService;

namespace BPM.Base.WFLib
{
    [System.Drawing.ToolboxBitmap(typeof(加载数据), "pic.filed.png")]
    public partial class 加载数据 : Activity
    {
        //
        状态机模板 Root()
        {
            Activity o = this.Parent;

            while (o.Parent != null)
            {
                o = o.Parent;
            }
            状态机模板 tp = o as 状态机模板;

            if (tp != null)
            {
                return tp;
            }
            else
            {
                throw new System.Exception("GetRoot");
            }

        }

        //
        protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {
            //[1 得到数据 ]

            WorkflowService service = executionContext.GetService(typeof(WorkflowService)) as WorkflowService;
            if (service != null)
            {
              返回值=  service.getDataFormFiled(this.标识符, this.字段, this.表达式);
            }
      
            return base.Execute(executionContext);
        }


        //-[标识符]
        public static DependencyProperty 标识符Property = DependencyProperty.Register("标识符", typeof(Guid), typeof(加载数据));

        [DescriptionAttribute("")]
        [CategoryAttribute("")]
        [BrowsableAttribute(true)]
        [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
        public Guid 标识符
        {
            get
            {
                return ((Guid)(base.GetValue(加载数据.标识符Property)));
            }
            set
            {
                base.SetValue(加载数据.标识符Property, value);
            }
        }

        //-[字段]
        public static DependencyProperty 字段Property = DependencyProperty.Register("字段", typeof(string), typeof(加载数据), new PropertyMetadata(""));

        [DescriptionAttribute("")]
        [CategoryAttribute("")]
        [BrowsableAttribute(true)]
        [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
        public string 字段
        {
            get
            {
                return ((string)(base.GetValue(加载数据.字段Property)));
            }
            set
            {
                base.SetValue(加载数据.字段Property, value);
            }
        }

        //-[表达式]
        public static DependencyProperty 表达式Property = DependencyProperty.Register("表达式", typeof(string), typeof(加载数据), new PropertyMetadata(""));

        [DescriptionAttribute("")]
        [CategoryAttribute("")]
        [BrowsableAttribute(true)]
        [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
        public string 表达式
        {
            get
            {
                return ((string)(base.GetValue(加载数据.表达式Property)));
            }
            set
            {
                base.SetValue(加载数据.表达式Property, value);
            }
        }


        //-[返回值]
        public static DependencyProperty 返回值Property = DependencyProperty.Register("返回值", typeof(string), typeof(加载数据), new PropertyMetadata(""));

        [DescriptionAttribute("")]
        [CategoryAttribute("")]
        [BrowsableAttribute(true)]
        [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
        public string 返回值
        {
            get
            {
                return ((string)(base.GetValue(加载数据.返回值Property)));
            }
            set
            {
                base.SetValue(加载数据.返回值Property, value);
            }
        }
    
    
    
    
    }
}
